package de.hwr.sudokuspielehr.ui.listener;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JSlider;

import de.hwr.sudokuspielehr.ui.UserInterface;

public class ColorButtonListener implements ActionListener {

	private UserInterface ui;
	private JSlider red;
	private JSlider green;
	private JSlider blue;

	public ColorButtonListener(UserInterface pUi, JSlider pRed, JSlider pGreen, JSlider pBlue) {
		ui = pUi;
		red = pRed;
		green = pGreen;
		blue = pBlue;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		ui.setColor(new Color(red.getValue(), green.getValue(), blue.getValue()));
		ui.refresh();
	}
}
